#!/bin/sh
PROFILE="--auto"
XCOM=$(xrandr -q | grep -E "DP[0-3] connected" | sed -n 's/^\(DP[0-3]\).*/\1/p')
TCOM=$(xrandr -q | grep -E "HDMI[0-3] connected" | sed -n 's/^\(HDMI[0-3]\).*/\1/p')
arg=$1
wallpaper=~/.config/wallpaper
LPS="LVDS1"

if [ -n "$XCOM" ]
then
	#echo "Display $XCOM Detected"
	PROFILE="--output $XCOM --auto --left-of $LPS"
elif [ -n "$TCOM" ]
then
	#echo "TV $TCOM detected"
	PROFILE="--output $TCOM --mode 1680x1050 --right-of $LPS"
fi

#Execute the command
xrandr $PROFILE
xwallpaper --zoom $wallpaper
